﻿using SrBBSPro.BaseClasses;
using System;
using NPoco;

namespace SrBBSPro.Entities
{
    [TableName("HolidayCount")]
    [PrimaryKey("Id")]
    public class HolidayCount : BaseEntity<long>
    {
        public string Title { get; set; } 

        public DateTime StartDate { get; set; }

        public DateTime EndDate { get; set; }

        public string Year { get; set; }

        [Ignore]
        public  string OutDate
        {
            get  => DateTime.Compare(StartDate, DateTime.Now) <0 ? "是" :"否";
        }

        [Ignore]
        public int Days
        {
            get => MinusDate(EndDate,StartDate);
        }

        public string UserId { get; set; }

        [Reference(ReferenceType.OneToOne, ColumnName = "UserId", ReferenceMemberName = "Id")]
        public User User { get; set; }
    }
}
